<!DOCTYPE html>
<html><head>
        <meta charset="utf-8">
    <title>学无止境，耐得住寂寞的人最坚强！</title>

    <meta name="description" content="Dashboard">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--Basic Styles-->
    <link href="__ADMIN__/style/bootstrap.css" rel="stylesheet">
    <link href="__ADMIN__/style/font-awesome.css" rel="stylesheet">
    <link href="__ADMIN__/style/weather-icons.css" rel="stylesheet">

    <!--Beyond styles-->
    <link id="beyond-link" href="__ADMIN__/style/beyond.css" rel="stylesheet" type="text/css">
    <link href="__ADMIN__/style/demo.css" rel="stylesheet">
    <link href="__ADMIN__/style/typicons.css" rel="stylesheet">
    <link href="__ADMIN__/style/animate.css" rel="stylesheet">
    
</head>
<body>
    {include file="public/header"}
    <!-- /头部 -->
    
    <div class="main-container container-fluid">
        <div class="page-container">
                        <!-- Page Sidebar -->
            {include file="public/left"}
            <!-- /Page Sidebar -->        
            <!-- Page Content -->
            <div class="page-content">
                <!-- Page Breadcrumb -->
                <div class="page-breadcrumbs">
                    <ul class="breadcrumb">
                                        <li>
                        <a href="{:url('index/index')}">系统</a>
                    </li>
                                        <li class="active">字段管理</li>
                                        </ul>
                </div>
                <!-- /Page Breadcrumb -->

                <!-- Page Body -->
                <div class="page-body">
                    
<button type="button" tooltip="添加字段" class="btn btn-sm btn-azure btn-addon" onClick="javascript:window.location.href = '{:url('ModelField/add')}'"> <i class="fa fa-plus"></i> Add
</button>
<div class="row">
    <div class="col-lg-12 col-sm-12 col-xs-12">
        <div class="widget">
            <div class="widget-body">
                <div class="flip-scroll">
                    <table class="table table-bordered table-hover">
                        <thead class="">
                            <tr>
                                <th width="6%" class="text-center">ID</th>
                                <th width="15%" class="text-center">字段名称</th>
                                <th width="15%" class="text-center">英文名</th>
                                <th  class="text-center">字段类型</th>
                                <th  class="text-center">所属模型</th>
                                <th width="20%" class="text-center">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            {volist name="modelfield" id="field"}
                            <tr>
                                <td align="center">{$field.id}</td>
                                <td align="center">{$field.field_cnname}</td>
                                <td align="center">{$field.field_enname}</td>
                                <td align="center">
                                <!-- 1,文本输入框；2单选按钮3,复选框4,下拉菜单5,文本域6,附件类型 7浮点型 8、整型9.长文本类型longtext-->
                                {switch $field.field_type}
                                    {case value="1"}单行文本{/case}
                                    {case value="2"}单选按钮{/case}
                                    {case value="3"}复选框{/case}
                                    {case value="4"}下拉菜单{/case}
                                    {case value="5"}文本域{/case}
                                    {case value="6"}附件类型{/case}
                                    {case value="7"}浮点型{/case}
                                    {case value="8"}整型{/case}
                                    {case value="9"}长文本类型{/case}
                                    {default /}default
                                {/switch}
                                </td>
                                <td align="center">{$field.model_name}</td>
                                <td align="center">
                                    <a href="{:url('ModelField/edit',['id'=>$field['id']])}" class="btn btn-primary btn-sm shiny">
                                        <i class="fa fa-edit"></i> 编辑
                                    </a>
                                    <a href="#" fieldid="{$field.id}" onClick="del(this);"
                                        class="btn btn-danger btn-sm shiny">
                                        <i class="fa fa-trash-o"></i> 删除
                                    </a>
                                </td>
                            </tr>
                           {/volist}                           
                        </tbody>
                    </table>
                </div>
                <div style="padding-top: 10px;text-align: center;">
                {$modelfield->render()}
                 </div>
            </div>
        </div>
    </div>
</div>

                </div>
                <!-- /Page Body -->
            </div>
            <!-- /Page Content -->
		</div>	
	</div>

	    <!--Basic Scripts-->
    <script src="__ADMIN__/style/jquery_002.js"></script>
    <script src="__ADMIN__/style/bootstrap.js"></script>
    <script src="__ADMIN__/style/jquery.js"></script>
    <script src="__ADMIN__/org/layer/layer.js"></script>
    <!--Beyond Scripts-->
    <script src="__ADMIN__/style/beyond.js"></script>
    <script>
         //ajax异步删除模型
    function del(obj){
         layer.confirm('确定要删除该字段吗？', {icon: 3, title:'提示'}, function(index){
               var fieldid=$(obj).attr('fieldid');  
                    $.ajax({
                    type:"post",
                    dataType:"json",
                    data:{fieldid:fieldid},
                    url:"{:url('ModelField/del')}",
                    success:function(data){
                        //alert(data);
                            if(data == 1){
                                layer.msg('删除字段成功！', {icon: 1});
                                window.location.href="{:url('ModelField/lst')}";
                            }else{
                                layer.msg('删除字段失败！', {icon: 2});
                            }
                    }
                    });
          layer.close(index);
        });      

    }



    </script>


</body></html>